package com.neusoft.elmboot.mapper;

import java.math.BigDecimal;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.neusoft.elmboot.po.VirtualWallet;

/**
 * @author chj
 * @date 2024年10月20日
 */
@Mapper
public interface VirtualWalletMapper {

	@Select("select * from virtualwallet where walletId=#{walletId}")
	public VirtualWallet getVirtualWallet(Long walletId);

	@Update("update virtualwallet set balance=#{balance} where walletId=#{walletId}")
	public int updateBalance(Long walletId, BigDecimal balance);

	@Update("update virtualwallet set overdraftAmount=#{overdraftAmount} where walletId=#{walletId}")
	public int updateOverdraftAmount(Long walletId, BigDecimal overdraftAmount);

	@Update("update virtualwallet set frozenAmount=#{frozenAmount} where walletId=#{walletId}")
	public int updateFrozenAmount(Long walletId, BigDecimal frozenAmount);

	@Update("update virtualwallet set isVIP=#{isVIP} where walletId=#{walletId}")
	public int updateIsVIP(Long walletId, boolean isVIP);

	@Update("update virtualwallet set isAllowedOverdraft=#{isAllowedOverdraft} where walletId=#{walletId}")
	public int updateIsAllowedOverdraft(Long walletId, boolean isAllowedOverdraft);

	@Insert("insert into virtualwallet(walletId,createTime,balance,isVIP,isAllowedOverdraft,overdraftAmount,frozenAmount) values(#{walletId},#{createTime},#{balance},#{isVIP},#{isAllowedOverdraft},#{overdraftAmount},#{frozenAmount})")
	public int saveVirtualWallet(VirtualWallet wallet);
}
